package com.apes.auto.maintain.model;

import com.apes.auto.car.model.*;
import com.apes.framework.jpa.ApesBean;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 * @ClassName LatestCarModel
 * @Description 最新车型
 * @Author pengyb
 * @Date 2019/8/8 15:37
 * @Version 1.0
 **/
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = LatestCarModel.CONST_TABLE_NAME, indexes = {
        @Index(columnList = "CXID", unique = true)
})
public class LatestCarModel implements ApesBean {
    public static final String CONST_TABLE_NAME = "cxb_new";

    @Id
    @Column(name = "levelID", length = 32)
    @Comment("levelID")
    private String levelID;

    @Column(name = "CXID", length = 32)
    @Comment("车型ID")
    private String CXID;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "CP", referencedColumnName = "id")
    @Comment("厂牌")
    private VehicleLabel CP;  //根据品牌和厂商

    @NotNull
    @Comment("品牌")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "PP", referencedColumnName = "id")
    private CarBrand PP;

    @NotNull
    @Comment("厂商")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "CS", referencedColumnName = "id")
    private Manufacturers CS;


    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "CX", referencedColumnName = "id")
    @Comment("车型")
    private VehicleType CX;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "QCLX", referencedColumnName = "id")
    @Comment("汽车类型")
    private AutoCategory QCLX;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "QCDJ", referencedColumnName = "id")
    @Comment("汽车等级")
    private AutoLevel QCDJ;


    @Column(name = "NK", length = 4)
    @Comment("年款")
    private Integer NK;


    @Column(name = "XSZDJ", length = 32)
    @Comment("指导价【万元】")
    private String XSZDJ;

    @Column(name = "FDJXH", length = 32)
    @Comment("发动机型号")
    private String FDJXH;


    @Column(name = "PL", length = 16)
    @Comment("排量")
    private String PL;


    @Column(name = "DWSL", length = 22)
    @Comment("挡位数")
    private Integer DWSL;

    @Column(name = "YJFS", length = 16)
    @Comment("引进方式")
    private String YJFS;


    @Column(name = "RLLX", length = 16)
    @Comment("燃料类型")
    private String RLLX;

    @Column(name = "BSXXH", length = 16)
    @Comment("变速箱型号")
    private String BSXXH;


    @Column(name = "BSQLX", length = 16)
    @Comment("变速器类型")
    private String BSQLX;


    @Column(name = "BSQMS", length = 200)
    @Comment("变速器描述")
    private String BSQMS;

    @Column(name = "KT", length = 8)
    @Comment("空调")
    private String KT;

    @Column(name = "XSBB", length = 8)
    @Comment("销售版本")
    private String XSBB;

    @Column(name = "rnum", length = 16)
    @Comment("自增长序号")
    private String rnum;


}
